   ============================================================

     With personal permission by Anders Hejlsberg.
     Translated feb. 1992 from Danish to English by
     Thorleif Bundgaard.  eMail: thorleif@fam-bundgaard.dk   

   ============================================================



                  Floating Point Package Math48
         Version 1.1 Revision 1 by Anders Hejlsberg 1718 Bytes

     48 bit floating point mathematic package for Z-80 based
     microcomputers. Copyright (C) 1980 Blue Label Software



    Introduktion:
   ============================================================
     Math48 is a floating numbers mathematic package for Z-80 based
     microcomputers. The program which occupy only 2.5 KByte, converts
     6 of the Z-80 processors 16-bit registers to two floating numbers
     accumulators, with 40 bits mantissa and 8 bits exponent. This
     architecture makes it possible to perform very fast floating
     number calculations with app. 11 significant digits.

     Math48 contain 25 subroutines with these functions:

       Addition, Subtraktion, Multiplikation, and Division
       Modulus and Exponentiation
       Square rooth computation
       Trigonometric and inverse trigonometric functions
       Log and Exponentiation functions
       Whole numbers and fractional calculations
       Convertion to and from 16-bits fixed number
       convertion from tekststreng to floating point
       Formatted printout in fixed figitpoint or exponential notation.

     Math48 require no other workspace than the system stak,
     This will make recursive programmering possible, at the same time as
     it eases the programming, because a work space assignment to fixed
     addresses is not needed.

    Floating number format.
   ============================================================

     A floating number is made by the three 16-bit registers BC, DE and HL
     (collectively called AC) or the corresponding alternative registers
     BC', DE' og HL' (collectively called AC').

     The five 8-bit registers B,C,D,E and H (Collectively called BCDEH) represent
     in the mentioned succession the number mantissa in binary representation.
     The binary decimal point is placed immediately in front of the B register.
     In this way, the bit 7 of B tell the number of halves (2^-1) in the number,
     bit 6 the number of quarters (2^-2) etc.
     The value of the mantissa may also be aprehended as the binary integer
     BCDEH divided by 2^40.

     The L register contain the number exponent, that is the number 2 must be
     raised to, to give the factor that the mantissa shall be multiplied by.
     The absolute value of the L register is the exponent plus
     128 (80H). If for example L has the value 83H the exponent will be 3.
     If L has the value 7DH the exponent is -3.
     If L is zero it tells that the whole number is zero. In this way the
     exponent may take any integer value between -127 (01H) and 127 (FFH).

     Of this it is seen that the number in AC shall be comprehended in the
     following way.

         AC=(BCDEH/2^40)*2^(L-128)

     Where BCDEH is a whole binary number.

     As the exponent is the power that 2 shall be raised to, then it is given,
     that the value of AC is doubled if one is added to the exponent, and
     halved if one is subtracted from the exponent.
     Likewise it is given that the number in BCDEH is doubled if it is shifted
     one bit to the left and halved if it is shifted one bit to the right.
     One may therefore, theoretically speaking, shift BCDEH to right or
     left an arbitrary number of bits, as long as this number is added or
     subtracted from the exponent.

     The above stated is exploited in every calculation to normalize
     the number in AC:
     The mantissa (BCDEH) is repeatedly shifted one bit left untill the
     most significant bit is set (bit 7 in B). Hereafter the number of shifts are
     subtracted from the exponent.

     This normalizing is done for two reasons: firstly is is
     securing that the number has the maximum precision, as it
     leaves the most significant bits in the mantissa.
     Secondly it releases the most significant bit of the mantissa,
     as this bit will always be set in a normalized number. The most
     significant bit is in stead used as a sign indicator:
     If it is set then the number is negative. If it is zero then the number
     is positive. The absolute value of a number may thus be calculated
     by simply resetting the bit 7 in the B register.

     The construction of a floating number is compiled to:

         Reg. Bit    Meaning

          B    7     Sign. 0=Positive. 1=Negative.
          B   6-0    mantissa bit   38-32. Bit 39 always set.
          C   7-0    mantissa bit   31-24.
          D   7-0    mantissa bit   23-16.
          E   7-0    hantisse bit   15-8.
          H   7-0    hantisse bit   7-0.
          L   7-0    L=0: the number is Zero.
                     L>0: Exponent+128 (80H).

     If a floating point number is zero (ie. if the L register is zero)
     then it does'nt matter what is in the mantissa as long as the sign
     bit is zero.

     Examples of floating point numbers (BCDEH and L in hexnotation):

      BCDEH       L   Value             Remarks

      0000000000  00  0                 L er nul.
      0000000000  81  1                 2^-1*2^1.
      0000000000  82  2                 2^-1*2^2.
      8000000000  82  -2                Negative as bit 7 in B is set.
      7000000000  84  15                (2^-1+2^-2+2^-3+2^-4)*2^4.
      4800000000  87  100               (2^-1+2^-2+2^-5)*2^7.
      4CCCCCCCCD  7D  0.1               Not final
      0000000000  01  2.938735877E-39   Smallest possible number.
      7FFFFFFFFF  FF  1.701411835E+38   Largest possible number.
     ===================================================================

     Notice that the number 0.1 is NOT final. this proves, that a number
     having a final number of digits in one number system (here the decimal system)
     not necessarily has a finite number of digits in another
     (here the binary number system)

     The following method may be used to convert numbers from the decimal system
     to floating point number format (in hex notation):

     1)   Make the number positive. Take the binary logarithm of the number
          (log2(x)=ln(x)/ln(2)), and round to the nearest integer
          that is larger than the result. This is the exponent.

     2)   Divide the number by 2 raised to the exponent. The number now
          lies in the interval 1>X>=0.5, which means thet the number is
          normalized

     3)   Multiply by 16. The integer part of the result
          (minus 8 if the number we convert was positive) is the
          first hexdigit in the mantissa. that is. MSD in B register.

     4)   Subtract the integer from the number, so that it now lies
          in the interval 1>X>=0. Again multiply by 16. The integer part
          of the result is the second hexdigit in the mantissa,
          that is LSD in B register.

          continue in this manner until the remaining 8 hex digits are
          computed. if the 11.th. hex digit is larger than 7 the number
          should be rounded by adding 1 to BCDEH.

    Math48 SUBRUTINES
   ============================================================
     In the following we use these abbreviations:

          AC   The floating number accumulator made by the 3
               16-bit registers BC, DE and HL.
          AC'   The floating number accumulator made by the 3
               16-bit  alternative registers BC', DE' and HL'.
          CF   Carry flag in the statusregister F.
          ZF   Zero flag in the statusregister F.

     By call of a MATH49 subroutine the following registers
     are changed: AC, AF and AF'. The registers AC', IX and IY do
     not change value.

     In the description of each single subroutine, the following
     data is given:

     NAME:        Name of the Subroutine.
     FUNCTION:    The function performed by the subroutinen.
     OFFSET:      The hexnumber to be added to Math48 startaddress
                  to get the subroutine startaddress.
     INPUT:       If this field is shown it gives the parameters
                  necessary for the subroutinen, except for AC
                  and possibly AC'.
     OUTPUT:      If this field is shown it gives the parameters
                  returned by the subroutine, except for AC.
     STAK:        The maximum number of bytes used on the stack
                  except the 2 bytes used in the call.
     EXAMPLE:     Possible number examples.

     If a calculation gives an overflow (the absolute value of
     AC would exceed 1.701411835E+38) then CF is set to 1. By
     overflow the number in AC is undefined.
     If a calculation gives an underflow (the absolute value of
     AC would be less than 2.938735877E-39) then AC is set to 0.


     FUNCTIONS WITH TWO ARGUMENTS
   ============================================================

     Addition
     --------

     NAME:      FPADD
     FUNCTION:  AC=AC+AC'. The number in AC' is added to the
                number in AC and the result is placed in AC.
     OFFSET:    00H
     OUTPUT:    CF=0: OK.
                CF=1: Overflow.
     STACK:     10 bytes.


     Subtraktion
     ------------

     NAME:      FPSUB
     FUNCTION:  AC=AC-AC'. The number in AC' is subtracted from
                the number in AC and the result is placed in AC.
     OFFSET:    03H
     OUTPUT:    CF=0: OK.
                CF=1: Overflow.
     STACK:     12 bytes.


     Multiplication
     --------------

     NAME:      FPMUL
     FUNCTION:  AC=AC*AC'. The number in AC is multiplied by
                the number in AC' and the result is placed in AC.
     OFFSET:    06H
     OUTPUT:    CF=0: OK.
                CF=1: Overflow.
     STACK:     16 bytes.


     Division
     --------

     NAME:      FPDIV
     FUNCTION:  AC=AC/AC'. The number in AC is divided by the
                number in AC' and the result is placed in AC.
     OFFSET:    09H
     OUTPUT:    CF=0: OK.
                CF=1: Overflow or AC' equal to 0.
     STACK:     16 bytes.


     Modulus
     -------

     NAME:      MOD
     FUNCTION:  AC=AC MOD AC' or AC=FRAC(AC/AC')*AC'. AC is set
                equal to the remainder of the division of AC by AC'.
                The result has the same sign as AC.
     OFFSET:    0CH
     OUTPUT:    CF=0: OK.
                CF=1: Division AC/AC' gives overflow, or
                      AC' is 0.
     STACK:     22 bytes.
     Exponentiation
     ----------------

     NAME:      PWR
     FUNKTZON:  AC=AC^AC' or AC=EXP(AC'*LN(AC)). AC is set equal
                to AC raised to the exponent given in AC'.
     OFFSET:    0FH
     OUTPUT:    CF=0: OK.
                CF=1:  Overflow.
     STACK:     12 bytes.


     Comparison
     -------------

     NAME:      CMP
     FUNCTION:  Compare AC to AC'.
     OFFSET:    12H
     OUTPUT:    ZF=1:      AC-AC'.
                ZF=0,CF=0: AC>AC'.
                ZF=0,CF=1: AC<AC'.
     STACK:     2 bytes




    FUNCTIONS WITH ONE ARGUMENT
   ============================================================

     Square Root
     -----------

     NAME:      SQR
     FUNCTION:  AC=SQR(AC). AC is set equal to the square root
                of AC.
     OFFSET:    15H
     OUTPUT:    CF=0: OK.
                CF=1: AC<0.
     STACK:     31 bytes.


     Natural logaritm
     ----------------

     NAME:      LN
     FUNCTION:  AC=LN(AC). AC is set equal to the natural
                logarithm of AC.
     OFFSET:    18H
     OUTPUT:    CF=0: OK.
                CF=1: AC<=0.
     STACK:     10 bytes.


     Exponentiation
     --------------

     NAME:      EXP
     FUNCTION:  AC=EXP(AC). AC is set equal to e raised to the
                exponent given in AC, where e is the base number
                for the natural logarithm.
     OFFSET:    1BH
     OUTPUT:    CF=0: OK.
                CF=1: Overflow.
     STACK:     40 bytes.


     Ten's logarithm
     ---------------

     NAME:      LOG
     FUNCTION:  AC=LOC(AC) or AC=LN(AC)/LN(10). AC is set equal
                to the ten's logarithm of AC.
     OFFSET:    1EH
     OUTPUT:    CF=0: OK.
                CF=1: AC<=0.
     STACK:     42 bytes.


     Sine
     ----

     NAME:      SIN
     FUNCTION:  AC=SIN(AC). AC is set equal to sine of AC. If the
                absolute value of AC is larger than 2*PI then AC is
                set equal to AC MOD 2*PI before calculating the sine.
     OFFSET:    21H
     STACK:     10 bytes.

     Cosine
     -------

     NAME:      COS
     FUNCTION:  AC=COS(AC) or AC=SIN(PI/2-AC). AC is set equal to
                the cosine of AC.
     OFFSET:    24H
     STACK:     10 bytes.


     Tangent
     -------

     NAME:      TAN
     FUNCTION:  AC=TAN(AC) eller AC=SIN(AC)/COS(AC). AC is set equal
                to the tangent of AC.
     OFFSET:    27H
     OUTPUT:    CF=0: OK.
                CF=1: Overflow of the division SIN(AC)/COS(AC), ie.
                      AC has a value given by AC=PI/2+n*PI, where
                      n is a whole number.
     STACK:     12 bytes.


     Arc tangent
     -----------

     NAME:      ATN
     FUNCTION:  AC=ATN(AC). AC is set equal to the arc tangent of AC.
                The returned values lies in the interval
                PI/2 > ATN(AC) > -PI/2.
     OFFSET:    2AH
     STACK:     42 bytes.
     EXAMPLE:   ATN( 1 )=PI/4
                ATN(-1 )=-PI/4


     Set AC equal to PI
     ------------------

     NAME:      ACPI
     FUNCTION:  AC=PI. AC is set equal to 3.14159265359.
     OFFSET:    2DH
     STACK:     0 bytes.


     Integer
     -------

     NAME:      INT
     FUNCTION:  AC>=0: AC is set equal to the nearest integer that is
                       less than or equal to the number in AC.
                AC<0:  AC is set equal to the nearest integer that is
                       larger than or equal to the number in AC.
     OFFSET:    30H
     STACK:     8 bytes.
     EXAMPLE:   INT(3.7)=3
                INT(-3.7)=-3

     Fractional part
     ----------------

     NAME:      FRAC
     FUNCTION:  AC=FRAC(AC) or AC=AC-INT(AC). AC is set equal to
                the decimal part of AC with the same sign as AC.
     OFFSET:    33H
     STACK:     20 bytes.
     EXAMPLE:   FRAC(3.7)=0.7
                FRAC(-3.7)=-0.7


     Set AC' equal to AC
     -------------------

     NAME:      EQUAL
     FUNCTION:  AC'=AC. AC' is set equal to the number in AC.
     OFFSET:    36H
     STACK:     6 bytes.


     Multiply AC by 10
     -----------------

     NAME:      MUL10
     FUNCTION:  AC=ABS(AC)*10. AC is set equal to the absolute value
                of AC multiplied by 10.
     OFFSET:    39H
     OUTPUT:    CF=0: OK.
                CF=1: Overflow.
     STACK:     6 bytes.


     Convert floating point number to a 16-bit integer
     -------------------------------------------------

     NAME:      FIX.
     FUNCTION:  HL=FIX(AC). convert the integer part of the floating
                number in AC to a 16-bit 2's complement integer, and
                save the result in the HL register.
     OFFSET:    3CH
     OUTPUT:    CF=0: OK.
                CF=1: ABS(INT(AC)) > 32767
     STACK:     2 bytes.
     EXAMPLE:   FIX(1.5)=    1=  0001H
                FIX(-1.5)=  -1=  FFFFH
                FIX(0.5)=    0=  0000H


     Convert 16-bit integer to a floating point number
     -------------------------------------------------


     NAME:      FLOAT
     FUNCTION:  AC=FLOAT(HL). Convert the 16-bit 2's complement
                integer in HL to floating point number format
                and save the result in AC.
     OFFSET:    3FH
     STACK:     2 bytes.
     EXAMPLE:   FLOAT(0001H)=1
                FLOAT (FFFFH)=-1

    INPUT/OUTPUT ROUTINES
   ============================================================

     Convert Floating point number to a textstring
     ---------------------------------------------

     NAME:      FSTRS
     FUNCTION:  Convert the number in AC to a formatted textstring,
                and save it in the buffer pointed at by IX.
     OFFSET:    42H
     STACK:     15 bytes.
     INPUT:     FSTRS is called in the following way:

                       CALL FSTRS
                       DB   FLAGS
                       DB   FIELDS  <<changed so IX points at end 00 byte >>

                The textstring format is determined by the two bytes
                following immediately after the call (here called FLAGS
                and FIELDS). the format can be one of two possibilities.

                     saaaaa.bbbbb       Fixed pint notation
                     sa.bbbbbEtxx       Exponential notation

                S    Sign.
                aaa  Integer part (by exponential notation this part
                     only has one digit).
                bbb  Decimal part.
                E    Indicates exponential notation.
                t    the exponent sign (always "+" or "-").
                xx   Two digit exponent.

                The two following bytes has the following meaning:

                FLAGS:   This byte determins the format type

                Bit 0     Printing type
                           0 - Fixed point notation
                           1 - Exponential notation
                Bit2-1    Sign format
                           00 - No sign
                           01 - AC>=0: No sign
                                AC<0:  "-"
                           10 - AC>=0: " "
                                AC<0:  "-"
                           11 - AC>=0: "+"
                                AC<0:  "-"
                Bit  3    Decimal part format
                           0 - only significant digits
                           1 - Write all digits
                Bit  4    Integer part format
                           0 - Only significant digits
                           1 - Blanks before significant digits

                FIELDS:   This byte contain the length of the integer
                          and decimal fields.

                Bit 3-0   Decimal field length (0-15). If the length
                          is zero, no decimal point is written.
                Bit 7-1   Integer field length (1-15). A length of zero
                          will always result in an error, if fixed point
                          notation is selected. If exponential notation
                          is selected then the content of these 4 bits
                          are irrelevant as only 1 digit is printed.
             The user should make sure that the text buffer the IX
             register points at, at least has the length of DF+HF+2 for
             fixed point notation, and DF+8 for exponential notation,
             where DF is the decimal field length and HF is the integer
             field length.

     OUTPUT: CF=0: The textbuffer contain the formatted number
                   terminated by a byte with the value zero.
             CF=1: The number cannot be converted in the specified
                   format. the textbuffer is untouched.

     EXAMPLE: 
             In the following examples FLAGS is given in binary
             notation, and FIELDS in hexnotation:

             NUMBER    FLACS  FIELDS  TEXSTSTRENG

             123.456   00010    FF    '123.456',00H
             -78       00010    FF    '-78',00H
             123.456   00100    FF    ' 123.456',00H
             123.456   00110    FF    '+123.456',00H
             123.456   00010    F2    '123.46',00H
             0.5       00010    F2    '0.5',00H
             -78       00010    F2    '-78',00H
             123.456   01010    F2    '123.456',00H
             0.5       01010    F2    '0.50',00H
             -78       01010    F2    '-78.00',00H
             123.456   10010    5F    '  123.456',00H
             0.5       10010    5F    '    0.5',00H
             -78       10010    5F    '  -78',00H
             123.456   11010    52    '  123.46',00H
             0.5       11010    52    '    0.50',00H
             -78       11010    52    '  -78.00',00H
             0         11010    52    '    0.00',00H
             123.456   00101    0F    ' 1.23456E+02',00H
             0.5       00101    0F    ' 5E-01',00H
             -78       00101    0F    '-7.8E+01',00H
             123.456   00101    03    ' 1.235E+02',00H
             0.5       00101    03    ' 5E-01',00H
             -78       00101    03    '-7.8E+01',00H
             123.456   01101    03    ' 1.235E+02',00H
             0.5       01101    03    ' 5.000E-01',00H
             -78       01101    03    '-7.800E+01',00H
             0         01101    03    ' 0.000E+00',00H

     Convert Floating point number to a textstring
     ---------------------------------------------

     NAME:      FSTRR
     FUNCTION:  As FSTRS.
     OFFSET:    45H
     STACK:     15 bytes.
     INPUT:     The register HL' contain the format. L' represent
                FLAGS and H' represent FIELDS. The meaning of these
                are explained for FSTRS. A call could look like this:

                     EXX
                     LD   HL,(FORMAT)
                     EXX
                     CALL FSTRR

     OUTPUT:    As FSTRS.

     Convert a textstring to Floating point number
     ---------------------------------------------

     NAME:      CNVN
     FUNCTION:  Convert the textstring that the IX register point
                at, to a floating point number, and save the result
                in AC.
     OFFSET:    48H
     STACK:     20 bytes.
     INPUT:     IX register point to the first character in the
                textstring. The textstring must have one of the
                following formats:

                1)   saaa.bbb

                    s    Sign: If s is not present the number is assumed
                         to be positive. If s is present it must be "+"
                         or "-".
                    aaa  Integer part (any number of digits).
                    bbb  Decimal part (any number of digits).

                2)   saaa.bbbEtxx

                    E    Indicates that the number is followed by a 10's
                         exponent.
                    t    Exponent sign: If t is not present the exponent is
                         assumed to be positive. If t is present then it
                         must be "+" or "-".
                    xx   Exponent in the range 37>=xx>=-37.

                    The conversion stops at the first character that does
                    Not fit in the format.

     OUTPUT:    CF=0: AC contain the converted number.
                      IX point at the character immediately after the
                      number.
                CF=1: Overflow.

     EXAMPLE:   This program sets AC equal to 189.445:

                START:   LD   IX,NUMBER   ;Point at textstring
                         CALL CNVN        ;Convert
                         :
                         :
                NUMBER:  DB  '189.445 '   ;The space character stops
                                          ;the convertion

     <<< Change to CONV 8 digit and accept leading ZERO or SPACE >>>


     LNBR ADDR OBJ.CODE LABEL   MNEM OPERAND    COMMENT

     0001 1000                  ORC  1000H
     0002
     0003               ;This program compute and print the values
     0004               ;of sine and cosine for angles between 0 and
     0005               ;360 deg in steps of 10 degrees. The numbers in
     0006               ;the 4 columns have the following meaning:
     0007
     0008               ;1. Angle in degrees
     0009               ;2. Angle in radians
     0010               ;3. Sine to the angle
     0011               ;4. Cosine to the angle
     0012
     0013 0000          MRET:   EQU  0000H      ;Monitor Warmstart
     0014 0003          AOUT:   EQU  0003H      ;Printout the A register
     0015
     0016 8600          BASE:   EQU  8600H      ;Math4B startadresse
     0017
     0018 8600          FPADD:  EQU  BASE+00H
     0019 8606          FPMUL:  EQU  BASE+06H
     0020 8612          CMP:    EQU  BASE+12H
     0021 8621          SIN:    EQU  BASE+21H
     0022 8621          COS:    EQU  BASE+24H
     0023 8636          EQUAL:  EQU  BASE+36H
     0024 8612          FSTRS:  EQU  BASE+42H
     0025
     0026               ;Formatdefinitions
     0027
     0028 3012          FMT1:   EOU  30H*256+10010B
     0029 3A1A          FMT2:   EOU  3AH*256+11010B
     0030 4A1E          FMT3:   EOU  4AH*256+11110B
     0031
     0032
     0033 1000 DD217910         LD   IX,NUMBUF  ;Point at numberbuffer
     0031 1001 AF               XOR  A          ;Reset AC
     0035 1005 47               LD   B,A
     0036 1006 6F               LD   L,A
     0037
     0038 1007 CD4286   LOOP:   CALL FSTRS      ;Print angle in
     0039 100A 1230             DW   FMT1       ;degrees
     0040 100C CD6910           CALL PRNUM
     0041 100F C5               PUSH BC         ;Save angle
     0042 1010 D5               PUSH DE
     0043 1011 E5               PUSH HL
     0044 1012 D9               EXX             ;Exchange AC and AC'
     0045 1013 01FA0E           LD   BC,00EFAH  ;Set AC equal to PI/180
     0046 1016 111235           LD   DE,03512H
     0047 1019 217B96           LD   HL,0967BH
     0048 101C CD0686           CALL FPMUL      ;Recompute to radians
     0049 101F CD3686           CALL EQUAL      ;Save in AC'
     0050 1022 CD4286           CALL FSTRS      ;Print angle in
     0051 1025 1A3A             DW   FMT2       ;radians
     0052 1027 CD6910           CALL PRNUM
     0053 102A CD2186           CALL SIN        ;Compute sine
     0051 102D CD4286           CALL FSTRS      ;Print sine
     0055 1030 1E4A             DW   FMT3
     0056 1032 CD6910           CALL PRNUM
     0057 1035 D9               EXX             ;Get angle
     0058 1036 CD2486           CALL COS        ;Compute cosine
     0059 1039 CD4286           CALL FSTRS      ;Print cosine
     0060 103C 1E4A             DW   FMT3
     LNBR ADDR OBJ.CODE LABEL   MNEM OPERAND    COMMENT

     0061 103E CD6910           CALL PRNUM
     0062 1041 3E0D             LD   A,l3       ;New line
     0063 1043 CD0300           CALL AOUT
     0064 1046 E1               POP  HL         ;Get angle in degrees
     0065 1047 D1               POP  DE
     0066 1048 C1               POP  BC
     0067 1049 D9               EXX             ;Save in AC'
     0068 104A 010020           LD   BC,02000H  ;Set AC equal to 10
     0069 104D 110000           LD   DE,00000H
     0070 1050 218400           LD   HL,00084H
     0071 1053 CD0086           CALL FPADD      ;Add 10 to the angle
     0072 1056 D9               EXX             ;Save in AC'
     0073 1057 010034           LD   BC,03400H  ;set AC equal to 360
     0074 105A 110000           LD   DE,00000H
     0075 105D 218900           LD   HL,00089H
     0076 1060 CD1286           CALL CMP        ;Is 360>AC?
     0077 1063 D9               EXX             ;Get the angle
     0078 1064 30A1             JR   NC,LOOP    ;Yes => LOOP
     0079
     0080 1066 C30000           JP   MRET       ;Jump to monitor
     0081
     0082               ;This subrutine prints the number in NUMBUF
     0083
     0084 1069 E5       PRNUM:  PUSH HL
     0085 106A 217910           LD   HL,NUMBUF
     0086 106D 7E       PR1:    LD   A,(HL)
     0087 106E B7               OR   A
     0088 106F 2806             JR   Z,PR2
     0089 1071 CD0300           CALL AOUT
     0090 1074 23               INC  HL
     0091 1075 18F6             JR   PR1
     0092 1077 E1       PR2:    POP  HL
     0093 1078 C9               RET
     0094
     0095 000F          NUMBUF: DS   15
     0096
     0097 1088                 END

                          SINUS & COSINUS
   ============================================================

            0  0.0000000000     +0.0000000000     +1.0000000000
           10  0.1745329252     +0.1736481777     +0.9848077530
           20  0.3490658504     +0.3420201433     +0.9396926208
           30  0.5235987756     +0.5000000000     +0.8660254038
           10  0.6981317008     +0.6127876097     +0.7660444431
           50  0.8726646260     +0.7660444431     +0.6427876097
           60  1.0471975512     +0.8660254038     +0.5000000000
           70  1.2217304764     +0.9396926208     +0.3420201433
           80  1.3962634016     +0.9848077530     +0.1736481777
           90  1.5707963268     +1.0000000000     +0.0000000000
          100  1 7453292520     +0.9848077530     -0.1736481777
          110  1.9198621772     +0.9396926208     -0.3420201433
          120  2.0943951024     +0.8660254038     -0.5000000000
          130  2.2689280276     +0.7660444431     -0.6427876097
          110  2.4434609528     +0.6427876097     -0.7660444431
          150  2.6179938780     +0.5000000000     -0.8660254038
          160  2.7925268032     +0.3420201433     -0.9396926208
          170  2.9670597284     +0.1736481777     -0.9848077530
          180  3.1415926536     +0.0000000000     -1.0000000000
          190  3.3161255788     -0.1736481777     -0.9848077530
          200  3.4906585040     -0.3420201433     -0.9396926208
          210  3.6651914292     -0.5000000000     -0.8660254038
          220  3.8397243544     -0.6427876097     -0.7660444431
          230  4.0142572796     -0.7660444431     -0.6427876097
          210  4.1887902048     -0.8660254038     -0.5000000000
          250  4.3633231300     -0.9396926208     -0.3420201433
          260  4.5378560552     -0.9848077530     -0.1736481777
          270  4.7123889804     -1.0000000000     +0.0000000000
          280  4.8869219056     -0.9848077530     +0.1736481777
          290  5.0614548308     -0.9396926208     +0.3420201433
          300  5.2359877560     -0.8660254038     +0.5000000000
          310  5.4105206812     -0.7660444431     +0.6427876097
          320  5.5850536064     -0.6427876097     +0.7660444431
          330  5.7595865316     -0.5000000000     +0.8660254038
          310  5.9341194568     -0.3120201433     +0.9396926208
          350  6.1086523820     -0.1736481777     +0.9848077530
          360  6.2831853072     +0.0000000000     +1.0000000000

          -----------------------------------------------------------
